/*
 * TypeTraits.h
 *
 *  Created on: May 20, 2013
 *      Author: Lucifer
 */

#ifndef TYPETRAITS_H_
#define TYPETRAITS_H_

////////////////////////////////////////////////////////////////////////////////
// Unfortunately. not all environments support stl::is_pointer, stl::is_member_pointer, boost::mpl::if_c ...etc,
// so I have to do this.

namespace tt
{

////////////////////////////////////////////////////////////////////////////////
// stl

// TEMPLATE CLASS integral_constant
template<class _Ty, _Ty _Val>
struct integral_constant
{	// convenient template for integral constant types
	static const _Ty value = _Val;

	typedef _Ty value_type;
	typedef integral_constant<_Ty, _Val> type;
};

typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;

// TEMPLATE _Cat_base
template<bool>
struct _Cat_base;
template<>
struct _Cat_base<false> : false_type
{	// base class for type predicates
};

template<>
struct _Cat_base<true> : true_type
{	// base class for type predicates
};

// Type modifiers
// TEMPLATE CLASS remove_const
template<class _Ty>
struct remove_const
{	// remove top level const qualifier
	typedef _Ty type;
};

template<class _Ty>
struct remove_const<const _Ty>
{	// remove top level const qualifier
	typedef _Ty type;
};

template<class _Ty>
struct remove_const<const _Ty[]>
{	// remove top level const qualifier
	typedef _Ty type[];
};

template<class _Ty, unsigned int _Nx>
struct remove_const<const _Ty[_Nx]>
{	// remove top level const qualifier
	typedef _Ty type[_Nx];
};

// TEMPLATE CLASS remove_volatile
template<class _Ty>
struct remove_volatile
{	// remove top level volatile qualifier
	typedef _Ty type;
};

template<class _Ty>
struct remove_volatile<volatile _Ty>
{	// remove top level volatile qualifier
	typedef _Ty type;
};

template<class _Ty>
struct remove_volatile<volatile _Ty[]>
{	// remove top level volatile qualifier
	typedef _Ty type[];
};

template<class _Ty, unsigned int _Nx>
struct remove_volatile<volatile _Ty[_Nx]>
{	// remove top level volatile qualifier
	typedef _Ty type[_Nx];
};

// TEMPLATE CLASS remove_cv
template<class _Ty>
struct remove_cv
{	// remove top level const and volatile qualifiers
	typedef typename remove_const<typename remove_volatile<_Ty>::type>::type type;
};

template<class _Ty>
struct _Is_memfunptr: false_type
{	// base class for member function pointer predicates
};

// TEMPLATE CLASS is_member_object_pointer
template<class _Ty>
struct _Is_member_object_pointer: false_type
{	// determine whether _Ty is a pointer to member object
};

template<class _Ty1, class _Ty2>
struct _Is_member_object_pointer<_Ty1 _Ty2::*> : _Cat_base<!_Is_memfunptr<_Ty1 _Ty2::*>::value>
{	// determine whether _Ty is a pointer to member object
};

template<class _Ty>
struct is_member_object_pointer: _Is_member_object_pointer<typename remove_cv<_Ty>::type>
{	// determine whether _Ty is a pointer to member object
};

// TEMPLATE CLASS is_member_function_pointer
template<class _Ty>
struct is_member_function_pointer: _Cat_base<_Is_memfunptr<typename remove_cv<_Ty>::type>::value>
{	// determine whether _Ty is a pointer to member function
};

// TEMPLATE CLASS is_member_pointer
template<class _Ty>
struct is_member_pointer: _Cat_base<is_member_object_pointer<_Ty>::value || is_member_function_pointer<_Ty>::value>
{	// determine whether _Ty is a pointer to member
};

// TEMPLATE CLASS is_pointer
template<class _Ty>
struct _Is_pointer: false_type
{	// determine whether _Ty is a pointer
};

template<class _Ty>
struct _Is_pointer<_Ty *> : _Cat_base<
		!is_member_object_pointer<_Ty *>::value && !is_member_function_pointer<_Ty *>::value>
{	// determine whether _Ty is a pointer
};

template<class _Ty>
struct is_pointer: _Is_pointer<typename remove_cv<_Ty>::type>
{	// determine whether _Ty is a pointer
};

////////////////////////////////////////////////////////////////////////////////
// _Is_memfunptr extensions

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)()> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)(...)> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)() const> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)(...) const> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)() volatile> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)(...) volatile> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)() const volatile> : true_type
{
};

template<class _Ret, class _Arg0>
struct _Is_memfunptr<_Ret (_Arg0::*)(...) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8...) const volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9)> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9...)>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9) const> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9...) const>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9) volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9...) volatile>
: true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9) const volatile> : true_type
{
};

template<class _Ret, class _Arg0, class _Arg1, class _Arg2, class _Arg3, class _Arg4, class _Arg5, class _Arg6,
		class _Arg7, class _Arg8, class _Arg9>
struct _Is_memfunptr<_Ret (_Arg0::*)(_Arg1, _Arg2, _Arg3, _Arg4, _Arg5, _Arg6, _Arg7, _Arg8, _Arg9...) const volatile>
: true_type
{
};

}	//	namespace std

////////////////////////////////////////////////////////////////////////////////
// mpl

namespace mpl
{

template<bool C, typename T1, typename T2>
struct if_c
{
	typedef T1 type;
};

template<typename T1, typename T2>
struct if_c<false, T1, T2>
{
	typedef T2 type;
};

}	//	namespace mpl

#endif /* TYPETRAITS_H_ */
